<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="f1()">ajax site</button>
<div id="div1">
    获取数据1
</div>

<button onclick="f2()">JSONP</button>
<div id="div2">
    获取数据2
</div>
</body>
<script src="/static/jquery.min.js"></script>
{#<script src="/static/jquery-3.4.1.js"></script>#}
{#<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>#}

{#<script src="http://127.0.0.1:8011/jquery_get/"></script>#}

<script type="text/javascript">
    function f1() {
        $.ajax({
            url: "http://127.0.0.1:8011/jquery_get/?zgswlcom=?&aaa=1&bbb=2&ccc=3",
            dataType: "jsonp",            //必须有，告诉server，这次访问要的是一个jsonp的结果。
            jsonp: 'zgswlcom',          //jQuery帮助随机生成的：callbacks="wner"
            jsonp:'a',
            jsonp:'b',
            jsonp:'c',
            success: function (data) {
                a = JSON.stringify(data);
                {#alert(a);#}
                $("#div1").html(a);

                obj = JSON.parse(a);
                {#alert(obj)#}
                {#console.log(typeof data);   //object#}
                console.log(data.name);     //["alex", "alvin"]
                console.log(data);          //Object {name: Array[2]}
            }
        });
    }

    function f2() {
        $.getJSON('http://127.0.0.1:8011/jquery_get/?zgswlcom=?&aaa=1&bbb=2&ccc=3', function (data) {
            {#alert('f2');#}
            {#alert(typeof(data));#}
            $("#div2").html(JSON.stringify(data));
        })
    }
</script>


</html>